<template>
	<el-button type="primary" :size="size" class='copy-bt' v-clipboard="content"
		v-clipboard:success="successHandler" v-clipboard:error="errorHandler" >
    <i class="el-icon-copy-document" />
    <!-- <svg-icon iconClass='file-copy'/> -->
		{{buttonText}}
	</el-button>
</template>

<style type="text/css" scoped>
	.copy-bt{
    border-radius: 8px;
	}
</style>

<script>
export default {
  name:"ClipboardButton",
  props: {
    buttonText:{
      type: String,
      default: '复制'
    },
    content: {
      type: String,
      default: ''
    },
    size: {
      type: String,
      default: ''
    }
  },
  data() {
      return {
        copyContent: '',
      }
  },
  methods: {
      successHandler(e){
         // this.$message.success("已复制");
         this.$message({ showClose: true, message: '已复制', type: 'success' });
      },
      errorHandler(){
       this.$message({ showClose: true, message: '复制失败', type: 'warning' });
       // this.$message.warn("复制失败");
      }
    }
}
</script>
